import http from "../utils/request"
import qs from "qs"
//退出登录
const logout = (data = {}) => {
  return http.request({
    url: "/logout",
    method: 'get',
    data: data
  })
}

// /user/login
const login = (data = {}) => {
  return http.request({
    url: "/login",
    method: 'post',
    data: qs.stringify(data),
    contentType: "application/x-www-form-urlencoded"
  })
}

// /user/register 用户注册
const register = (data = {}) => {
  return http.request({
    url: "/user/register",
    method: 'post',
    data: data
  })
}

//验证码 /user/sendCode/{email}
const sendCode = (data = {}) => {
  return http.request({
    url: "/user/sendCode/" + data.email,
    method: 'get',
    data: data
  })
}

//用户详情
const userInfo = (data = {}) => {
  return http.request({
    url: "/user/userInfo",
    method: 'get',
    data: data
  })
}


export {
  logout,
  login,
  register,
  sendCode,
  userInfo
}
